<template>
    <div class="customInfo" style="min-height: 600px;">
        <div class="principal_borrower">
            <Collapse v-model="openPanel" simple>
                <Panel name="1">
                    <span>主借人</span>
                    <span class="panel-head-right" @click.stop="checkCustomInfo('01','customInfoForm')"
                          v-show="!isShowDetails">
                        保存
                    </span>
                    <div slot="content">
                        <Form ref="customInfoForm" :model="customInfoForm" :rules="customInfoValidate"
                              :label-width="100"
                              :disabled="isShowDetails">
                            <div>
                                <!-- <h2 class="common_title extra_title">
                                    <span><Icon type="md-arrow-dropright" class="arrow_right"/>主借人</span>
                                    <span v-show="!isShowDetails" @click="checkCustomInfo('01','customInfoForm')"
                                            class="saveBtn">保存</span>
                                </h2> -->
                                <!-- 基本信息 -->
                                <div style="padding:0 45px">
                                    <div>
                                        <h2 class="levellow_title">基本信息</h2>
                                        <div>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="客户姓名" prop="custName">
                                                        <Input v-model="customInfoForm.custName" clearable
                                                               maxlength="32"
                                                               @on-change="spell()"
                                                               :disabled="customInfoForm.riskQueriedFlag||isSuggestRejectF||isReconsider||isSendBackToDealer"
                                                               placeholder="请输入"/>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="拼音/英文" prop="spellName">
                                                        <Input v-model="customInfoForm.spellName" clearable
                                                               maxlength="25"
                                                               :disabled="isReconsider"
                                                               placeholder="请输入"/>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="手机号" prop="telPhone">
                                                        <Input v-model="customInfoForm.telPhone" clearable
                                                               maxlength="11"
                                                               @on-change="isSignOk"
                                                               :disabled="isReconsider"
                                                               placeholder="请输入"/>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="证件类型" prop="certType">
                                                        <Select v-model="customInfoForm.certType" clearable
                                                                placeholder="请选择证件类型"
                                                                @click="singleSelectCertType"
                                                                @on-change="singleSelectCertType"
                                                                :disabled="customInfoForm.riskQueriedFlag||isReconsider||isSendBackToDealer">
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.certType"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="证件号码" prop="certNo">
                                                        <Input v-model="customInfoForm.certNo" clearable maxlength="18"
                                                               @on-change="certNoChange"
                                                               :disabled="customInfoForm.riskQueriedFlag||isSuggestRejectF||isReconsider||isSendBackToDealer"
                                                               placeholder="请输入"/>
                                                        <Button type="primary" @click="tagEleAuth"
                                                                :disabled="isNotCertNo||isBack">电子授权
                                                        </Button>
                                                    </FormItem>
                                                </Col>

                                                <Col span="8" class="pr">
                                                    <FormItem
                                                        label="证件到期日"
                                                        :rules="customInfoForm.isLongTerm?clearCertEndDate:requeirCertEndDate"
                                                        prop="certEndDate"
                                                        class="inline-block">
                                                        <DatePicker
                                                            @on-change="getDate()"
                                                            type="date"
                                                            v-model="customInfoForm.certEndDate"
                                                            placeholder="请选择证件到期日"
                                                            :disabled="customInfoForm.isLongTerm||isReconsider"
                                                            format="yyyy-MM-dd"
                                                        ></DatePicker>
                                                    </FormItem>
                                                    <FormItem label prop="isLongTerm" :label-width="0"
                                                              style="position: absolute;width:60px;left:320px;top:0">
                                                        <Checkbox v-model="customInfoForm.isLongTerm"
                                                                  :disabled="isReconsider"
                                                                  @on-change="selectCheckBox">长期
                                                        </Checkbox>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="出生年月" prop="birthday">
                                                        <DatePicker type="date" v-model="customInfoForm.birthday"
                                                                    placeholder="请选择"
                                                                    @on-change="countAge(customInfoForm.birthday)"
                                                                    :disabled="isReconsider"></DatePicker>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="户籍地址" prop="domicLocation">
                                                        <Cascader :data="location"
                                                                  v-model="customInfoForm.domicLocation"
                                                                  :load-data="loadData"
                                                                  :disabled="isReconsider"
                                                                  style="margin-top: 4px;"
                                                        ></Cascader>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="婚姻状况" prop="maritalStatus">
                                                        <Select
                                                            v-model="customInfoForm.maritalStatus"
                                                            clearable
                                                            placeholder="请选择婚姻状况"
                                                            :disabled="isReconsider"
                                                            @on-change="changeContect">
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.maritalStatus"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="性别" prop="sex">
                                                        <Select v-model="customInfoForm.sex" clearable
                                                                placeholder="请选择性别" :disabled="isReconsider"
                                                        >
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.sex"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="学历" prop="highestEducation">
                                                        <Select
                                                            v-model="customInfoForm.highestEducation"
                                                            clearable :disabled="isReconsider"
                                                            placeholder="请选择学历">
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.highestEducation"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="国籍" prop="nationality">
                                                        <Select v-model="customInfoForm.nationality" placeholder="请选择国籍"
                                                                :disabled="isReconsider"
                                                                clearable>
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.nationality"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                        </div>
                                    </div>
                                    <div>
                                        <h2 class="levellow_title">其他信息</h2>
                                        <div>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="驾驶证件" prop="drivingType">
                                                        <Select v-model="customInfoForm.drivingType" clearable
                                                                placeholder="请选择驾驶证件" :disabled="isReconsider"
                                                        >
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.drivingType"
                                                                :key="index"
                                                                :disabled="item.value=='1'&&isShowDriverCertype"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="驾驶证档案编号" v-if="customInfoForm.drivingType!='1'"
                                                              prop="drivingLicenceNo">
                                                        <Input
                                                            v-model="customInfoForm.drivingLicenceNo"
                                                            clearable
                                                            placeholder="请输入" maxlength="12" :disabled="isReconsider"
                                                        />
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                        </div>
                                    </div>
                                    <div>
                                        <h2 class="levellow_title">工作信息</h2>
                                        <div>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="单位名称" prop="unitName">
                                                        <Input v-model="customInfoForm.unitName" clearable
                                                               maxlength="128"
                                                               placeholder="请输入" :disabled="isReconsider"/>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="单位性质" prop="unitNature">
                                                        <Select v-model="customInfoForm.unitNature" clearable
                                                                placeholder="请选择单位性质" :disabled="isReconsider"
                                                        >
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.unitNature"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="行业类型" prop="industryType">
                                                        <Select
                                                            v-model="customInfoForm.industryType" clearable
                                                            placeholder="请选择行业类型" :disabled="isReconsider"
                                                        >
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.industryType"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="职业类型" prop="jobsType">
                                                        <Select v-model="customInfoForm.jobsType" placeholder="请选择职业类型"
                                                                :disabled="isReconsider"
                                                                clearable>
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.jobsType"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="职务" prop="position">
                                                        <Select v-model="customInfoForm.position" clearable
                                                                placeholder="请选择职务" :disabled="isReconsider"
                                                        >
                                                            <Option
                                                                :value="item.value"
                                                                v-for="(item,index) in dataDic.position"
                                                                :key="index"
                                                            >{{item.title}}
                                                            </Option>
                                                        </Select>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="本人月收入" prop="monthlyIncome">
                                                        <Input v-model="customInfoForm.monthlyIncome" clearable
                                                               maxlength="11" :disabled="isReconsider"
                                                               placeholder="请输入"/>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="工作年限" prop="workAge">
                                                        <Input
                                                            v-model="customInfoForm.workAge"
                                                            clearable
                                                            placeholder="请输入"
                                                            type="text"
                                                            maxlength="5"
                                                            :disabled="isReconsider"
                                                        />
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="公司电话" prop="companyPhone">
                                                        <Input v-model="customInfoForm.companyPhone" clearable
                                                               maxlength="20"
                                                               :disabled="isReconsider"
                                                               placeholder="请输入"/>
                                                    </FormItem>
                                                </Col>
                                                <Col span="8">
                                                    <FormItem label="家庭总收入" prop="totalIncome">
                                                        <Input v-model="customInfoForm.totalIncome" clearable
                                                               maxlength="11"
                                                               :disabled="isReconsider"
                                                               placeholder="请输入"/>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span="8">
                                                    <FormItem label="未结清贷款" prop="outstandingLoan">
                                                        <Input v-model="customInfoForm.outstandingLoan" clearable
                                                               maxlength="11"
                                                               :disabled="isReconsider"
                                                               placeholder="请输入"/>
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                        </div>
                                    </div>
                                    <div class="addressmsg">
                                        <h2 class="levellow_title">地址信息
                                            <Button
                                                @click="addLocation"
                                                v-show="!isShowDetails"
                                            >
                                                新增地址
                                            </Button>
                                        </h2>
                                        <div>
                                            <div v-for="(item,index) in customInfoForm.addressinfo" :key="index"
                                                 class="adresstype">
                                                <!-- <h3 v-show="index==0">现居住地址</h3> -->
                                                <!-- <h3 v-show="index==1">单位地址<span @click="copyAddressValue(index)"
                                                v-show="!isShowDetails">一键同上地址</span></h3> -->
                                                <h3 v-show="index==1&&!isShowDetails"><span
                                                    @click="copyAddressValue(index)"
                                                >一键同上地址</span></h3>
                                                <h3 v-show="index>1">地址类型<span class="del" v-show="!isShowDetails"
                                                                               @click="deleteAddress(item,index)">删除</span><span
                                                    @click="copyAddressValue(index)"
                                                    v-show="!isShowDetails">一键同上地址</span></h3>
                                                <div style="padding-top: 18px;">
                                                    <Row>
                                                        <Col span="8">
                                                            <FormItem label="地址类型"
                                                                      :prop="'addressinfo['+index+'].addressType'">
                                                                <Select v-model="item.addressType" clearable
                                                                        placeholder="请选择地址类型"
                                                                        :disabled="(customInfoForm.addressinfo[index].addressType==='2'&&index<=1)
                                                                        ||(customInfoForm.addressinfo[index].addressType==='3'&&index<=1)||isReconsider&&index<=1">
                                                                    <Option
                                                                        :value="item.value"
                                                                        v-for="(item,index) in dataDic.addressType"
                                                                        :key="index"
                                                                    >{{item.title}}
                                                                    </Option>
                                                                </Select>
                                                            </FormItem>
                                                        </Col>
                                                        <Col span="16">
                                                            <FormItem
                                                                label="详细地址"
                                                                :prop="'addressinfo['+index+'].detailAddressTemp'"
                                                                class="show_cascader_detail inline-block"
                                                                clearable
                                                            >
                                                                <Cascader
                                                                    :data="location"
                                                                    v-model="item.detailAddressTemp"
                                                                    placeholder="下拉选择省市"
                                                                    :load-data="loadData"
                                                                    :clearable="true"
                                                                    :disabled="isReconsider&&index<=1"
                                                                ></Cascader>
                                                            </FormItem>
                                                            <FormItem
                                                                :prop="'addressinfo['+index+'].inputDetail'"
                                                                style="width:50%;"
                                                                :label-width="0"
                                                                clearable
                                                                class="inline-block show_cascader_detail "
                                                            >
                                                                <Input
                                                                    v-model="item.inputDetail"
                                                                    placeholder="请输入详细地址"
                                                                    clearable
                                                                    :readonly="isreadonly"
                                                                    style="vertical-align: top;"
                                                                    class="wprecent100"
                                                                    maxlength="128"
                                                                    :disabled="isReconsider&&index<=1"
                                                                />
                                                            </FormItem>
                                                            <Radio v-model="customInfoForm.addressinfo[index].isShow"
                                                                   v-if="index<=1"
                                                                   :disabled="customInfoForm.addressinfo[index].isDefault"
                                                                   @click.native="setIsDefault(index)"
                                                                   style="margin-top: 5px;">邮寄地址
                                                            </Radio>
                                                        </Col>
                                                    </Row>
                                                    <Row v-if="index==0">
                                                        <Col span="8">
                                                            <FormItem label="房产类型"
                                                                      :prop="'addressinfo['+index+'].houseType'">
                                                                <Select v-model="item.houseType" clearable
                                                                        placeholder="请选择房产类型"
                                                                        :disabled="isReconsider&&index<=1"
                                                                >
                                                                    <Option
                                                                        :value="item.value"
                                                                        v-for="(item,index) in dataDic.houseType"
                                                                        :key="index"
                                                                    >{{item.title}}
                                                                    </Option>
                                                                </Select>
                                                            </FormItem>
                                                        </Col>
                                                        <Col span="8">
                                                            <FormItem label="房产起始时间"
                                                                      :prop="'addressinfo['+index+'].houseStartDate'">
                                                                <DatePicker
                                                                    type="date"
                                                                    :disabled="isReconsider&&index<=1"
                                                                    v-model="item.houseStartDate"
                                                                    placeholder="请选择房产起始时间"
                                                                ></DatePicker>
                                                            </FormItem>
                                                        </Col>
                                                    </Row>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </Form>
                        <Form
                            ref="emerContactForm"
                            :model="emerContactForm"
                            :rules="emerContactValidate"
                            :label-width="100"
                            :disabled="isShowDetails"
                        >
                            <!-- 基本信息 -->
                            <div style="padding: 0px 45px;">
                                <h2 class="levellow_title">紧急联系人信息
                                    <Button
                                        @click="addContactInfo"
                                        v-show="!isShowDetails"
                                    >
                                        新增联系人
                                    </Button>
                                </h2>
                                <div class="emerContact">
                                    <div v-for="(item,index) in emerContactForm.contactinfo"
                                         class="contactinfo"
                                         :key="index"
                                    >
                                        <h3 style="padding:0 20px" class="over">
                                                        <span class="del fr" v-show="!isShowDetails"
                                                              @click="deleteContactInfo(item,index)"
                                                              v-if="index>1"
                                                        >删除</span>
                                        </h3>
                                        <Row>
                                            <Col span="8">
                                                <FormItem label="与主借人关系"
                                                          :prop="'contactinfo['+index+'].custRelation'"
                                                >
                                                    <Select v-model="item.custRelation" clearable placeholder="请选择"
                                                            :disabled="index==0&&isCustRelation||isReconsider&&index<=1"
                                                            @on-change="checkCustRelation(item.custRelation,index)">
                                                        <Option
                                                            :value="item.value"
                                                            v-for="(item,index) in dataDic.custRelation"
                                                            :key="index"
                                                            :disabled="item.value=='00006'&&isDisabledCustRelation"
                                                        >{{item.title}}
                                                        </Option>
                                                    </Select>
                                                </FormItem>
                                            </Col>
                                            <Col span="8">
                                                <FormItem label="姓名" :prop="'contactinfo['+index+'].custName'">
                                                    <Input v-model="item.custName" maxlength="32" clearable
                                                           placeholder="请输入"
                                                           :disabled="isReconsider&&index<=1"/>
                                                </FormItem>
                                            </Col>
                                            <Col span="8">
                                                <FormItem label="手机号" :prop="'contactinfo['+index+'].telPhone'">
                                                    <Input v-model="item.telPhone" maxlength="11" clearable
                                                           placeholder="请输入"
                                                           :disabled="isReconsider&&index<=1"/>
                                                </FormItem>
                                            </Col>
                                        </Row>
                                        <Row>
                                            <Col span="8">
                                                <FormItem :prop="'contactinfo['+index+'].certType'">
                                                        <span slot="label"><b v-show="index==0&&isCustRelation"
                                                                              class="labelRequired">*</b>证件类型</span>
                                                    <Select v-model="item.certType" clearable placeholder="请选择"
                                                            @on-change="changeCertType(item.certType,index)"
                                                            :disabled="isReconsider&&index<=1">
                                                        <Option
                                                            :value="item.value"
                                                            v-for="(item,index) in dataDic.certType"
                                                            :key="index"
                                                        >{{item.title}}
                                                        </Option>
                                                    </Select>
                                                </FormItem>
                                            </Col>
                                            <Col span="8">
                                                <FormItem :prop="'contactinfo['+index+'].certNo'">
                                                        <span slot="label"><b v-show="index==0&&isCustRelation"
                                                                              class="labelRequired">*</b>证件号码</span>
                                                    <Input v-model="item.certNo" maxlength="32" clearable
                                                           placeholder="请输入"
                                                           :disabled="isReconsider&&index<=1"/>
                                                </FormItem>
                                            </Col>
                                            <Col span="8">
                                                <FormItem label="公司名称">
                                                    <Input v-model="item.companyName" maxlength="128" clearable
                                                           placeholder="请输入"
                                                           :disabled="isReconsider&&index<=1"/>
                                                </FormItem>
                                            </Col>
                                        </Row>
                                        <Row>
                                            <Col span="8">
                                                <FormItem :prop="'contactinfo['+index+'].monthlyIncome'">
                                                        <span slot="label"><b v-show="index==0&&isCustRelation"
                                                                              class="labelRequired">*</b>月收入</span>
                                                    <Input
                                                        v-model="item.monthlyIncome" clearable
                                                        placeholder="请输入"
                                                        :disabled="isReconsider&&index<=1"
                                                        :index="index"
                                                        maxlength="11"
                                                    />
                                                </FormItem>
                                            </Col>
                                            <Col span="16">
                                                <FormItem
                                                    label="详细地址"
                                                    :prop="'contactinfo['+index+'].detailAddressTemp'"
                                                    class="inline-block show_cascader_detail"
                                                >
                                                    <Cascader
                                                        :data="location"
                                                        v-model="item.detailAddressTemp"
                                                        placeholder="下拉选择省市"
                                                        :load-data="loadData"
                                                        :clearable="true"
                                                        :disabled="isReconsider&&index<=1"
                                                    ></Cascader>
                                                </FormItem>
                                                <FormItem
                                                    :prop="'contactinfo['+index+'].inputDetail'"
                                                    :style="{'position':'relative'}"
                                                    class="inline-block show_cascader_detail"
                                                    style="width:50%"
                                                    :label-width="0"
                                                >
                                                    <Input
                                                        v-model="item.inputDetail" clearable
                                                        placeholder="请输入详细地址"
                                                        :readonly="isreadonly"
                                                        style="vertical-align:top;width:100%;"
                                                        maxlength="128"
                                                        :disabled="isReconsider&&index<=1"
                                                    />
                                                </FormItem>
                                            </Col>
                                        </Row>
                                    </div>
                                </div>
                            </div>
                        </Form>
                    </div>
                </Panel>
            </Collapse>
            <common-borrower
                :tempBusinessType="tempBusinessType"
                :isNewCarDisabled="isNewCarDisabled"
                :isOldCarDisabled="isOldCarDisabled"
                :certTypeList="dataDic.certType"
                :maritalStatusList="dataDic.maritalStatus"
                :sexList="dataDic.sex"
                :highestEducationList="dataDic.highestEducation"
                :nationalityList="dataDic.nationality"
                :drivingTypeList="dataDic.drivingType"
                :unitNatureList="dataDic.unitNature"
                :industryTypeList="dataDic.industryType"
                :jobsTypeList="dataDic.jobsType"
                :positionList="dataDic.position"
                :addressTypeList="dataDic.addressType"
                :isSuggestRejectF="isSuggestRejectF"
                :houseTypeList="dataDic.houseType"
                :custRelationList="dataDic.custRelation"
                :commonBorrowerObj="commonBorrowerObj"
                :applyNo="applyNo"
                @queryInfo="queryInfo"
                :is-show-details="isShowDetails"
            ></common-borrower>
            <bail
                :tempBusinessType="tempBusinessType"
                :isNewCarDisabled="isNewCarDisabled"
                :isOldCarDisabled="isOldCarDisabled"
                :certTypeList="dataDic.certType"
                :isSuggestRejectF="isSuggestRejectF"
                :maritalStatusList="dataDic.maritalStatus"
                :sexList="dataDic.sex"
                :highestEducationList="dataDic.highestEducation"
                :nationalityList="dataDic.nationality"
                :drivingTypeList="dataDic.drivingType"
                :unitNatureList="dataDic.unitNature"
                :industryTypeList="dataDic.industryType"
                :jobsTypeList="dataDic.jobsType"
                :positionList="dataDic.position"
                :addressTypeList="dataDic.addressType"
                :houseTypeList="dataDic.houseType"
                :custRelationList="dataDic.custRelation"
                :bailObj="bailObj"
                :applyNo="applyNo"
                :is-show-details="isShowDetails"
                @queryInfo="queryInfo"
            ></bail>
        </div>
        <!--编辑弹窗-->
        <Modal v-model="editelectorAuthModel"
               title="电子授权"
               :mask-closable="false"
               :width="1100"
               @on-cancel="cancel"
               @on-ok="submit">
            <div class="electorAuthForm">
                <Form ref="electorAuthForm" :model="electorAuthForm" :rules="electorAuthFormRule" :label-width="120">
                    <Row>
                        <Col span="12">
                            <FormItem label="业务类型:" prop="businessType">
                                <Select v-model="electorAuthForm.businessType" clearable disabled>
                                    <Option value="01" :disabled="isNewCarDisabled">新车</Option>
                                    <Option value="02" :disabled="isOldCarDisabled">二手车</Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="手机号码:" prop="telPhone">
                                <Input v-model="electorAuthForm.telPhone" maxlength="11" clearable disabled/>
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="客户姓名:" prop="custName">
                                <Input v-model="electorAuthForm.custName" clearable disabled/>
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="身份证到期日:" prop="certEndDate">
                                <DatePicker type="date" v-model="electorAuthForm.certEndDate" disabled></DatePicker>
                            </FormItem>
                        </Col>
                        <Col span="12">
                            <FormItem label="证件号码:" prop="certNo">
                                <Input v-model="electorAuthForm.certNo" clearable disabled/>
                            </FormItem>
                        </Col>
                    </Row>
                </Form>
            </div>
            <div class="uploadInfo pr editElector">
                <label>影像信息:</label>
                <card-upload ref="editcarUpload" :frontType="contractFrontType" :balckType="contractBlackType"
                             :isPass="isPass"
                             @queryZmInfo="queryZmInfo"
                             @queryFmInfo="queryFmInfo"
                ></card-upload>
            </div>
            <!--二维码展示-->
            <div style="text-align: center" v-if="binary">
                <img id="rcode" :src="'data:image/PNG;base64,'+binary">
                <p style="font-size: 13px;">
                    <Icon type="ios-alert" color="red">
                    </Icon>&nbsp;请扫描二维码进行认证（有效时间:30分钟）
                </p>
            </div>
            <div slot="footer">
                <div v-if="!isPass">
                    <Button type="info" :disabled="isDisabled" v-if="binary"
                            @click="refreshQrCode()">{{codeName}}
                    </Button>
                    <Button size="small" type="info" @click="editTurnBack()"
                            icon="ios-backspace-outline">返回
                    </Button>
                    <Button type="primary" size="small" @click="submit" icon="ios-bookmark">提交</Button>
                </div>
            </div>
        </Modal>
    </div>
</template>
<script>
    import PlaceCascade from "@/components/place-cascade";
    import CommonBorrower from "./common-borrower/commonBorrower.vue";
    import Bail from "./bail/bail.vue";
    import {getLocation} from "_p/afs-apply/api/apply-report/personal/common.js";
    import {
        getContactList,
        getCustomerList,
        saveCustomerInfo,
        updateSignParams
    } from "_p/afs-apply/api/apply-report/personal/customInfo.js";
    import {deepClone} from "@/libs/utils/ObjectClone";
    import {
        deleteAddressInfo,
        deleteContectInfo,
        updateCustomerInfo
    } from "../../../../api/apply-report/personal/customInfo";
    import vPinyin from "../../../../assets/js/vue-py.js";
    import * as utils from "../../../../assets/js/utils";
    import {getByTypes} from "../../../../../basic/api/admin/datadic";
    import {formatDate} from "../../../../../../components/iview/components/date-picker/util";
    import CardUpload from "@/components/identitycard-upload"
    import {refresh} from "_p/afs-apply/api/pre-approve/preApproveManage-form-api";

    export default {
        name: "customInfo",
        data() {
            return {
                isReconsider: false,
                openPanel: [1, 2, 3],
                isBack: false,
                isSendBackToDealer: false,
                isSuggestRejectF: false,
                isNotCertNo: true,
                contractFrontType: "mainBorrowerIdcardFront",
                contractBlackType: "mainBorrowerIdcardBack",
                editelectorAuthModel: false,
                signResult: "",
                isPass: false,
                binary: "",
                codeName: "",
                refreshTime: '',
                electorAuthForm: {
                    businessType: "",
                    telPhone: "",
                    custName: "",
                    certEndDate: "",
                    certNo: "",
                },
                isDisabledCustRelation: false,
                isShowDriverCertype: false,
                setIsDefaultName: '设为邮寄地址',
                curIndex: 0,
                isPreApprove: false,
                totalLevel: 3,
                isCircle: true,
                isreadonly: false,
                domicLabel: "户籍所在地",
                domicValue: "domicLocation",
                singleAddress: true,
                location: [],
                listAddress: true,
                isCustRelation: false,
                isDisabled: false,
                // 主借人
                customInfoForm: {
                    custRole: '',
                    id: "",
                    custName: "",
                    personalAddressId: "",
                    permanentAdreess: [],
                    personalId: "",
                    spellName: "",
                    telPhone: "",
                    certType: "00001",
                    certNo: "",
                    birthday: "",
                    certEndDate: "",
                    isLongTerm: false,
                    domicLocation: [],
                    maritalStatus: "",
                    sex: "",
                    highestEducation: "",
                    nationality: "00001",
                    signFailNumber: 0,
                    drivingType: "0",
                    drivingLicenceNo: "",
                    age: '',
                    isLock: '',
                    unitName: "",
                    unitNature: "",
                    industryType: "",
                    jobsType: "",
                    position: "",
                    companyPhone: "",
                    monthlyIncome: "",
                    totalIncome: "",
                    outstandingLoan: "",
                    workAge: "",
                    //是否查询玄武
                    riskQueriedFlag: false,
                    addressinfo: [
                        {
                            id: "",
                            addressType: "2",
                            detailAddressTemp: [],
                            inputDetail: "",
                            houseType: "",
                            houseStartDate: "",
                            isDefault: false,
                            isShow: false,
                        },
                        {
                            id: "",
                            addressType: "3",
                            inputDetail: "",
                            detailAddressTemp: [],
                            isDefault: false,
                            isShow: false,
                        }
                    ]
                },
                customInfoValidate: {
                    companyPhone: [
                        {
                            validator: (rule, value, callback) => {
                                utils.isCheckPhoneAndFixedLinePhone(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ],
                    custName: [
                        {required: true, message: "客户姓名不能为空", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isNameValiate(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ],
                    spellName: [
                        {required: true, message: "客户英文名不能为空", trigger: "blur"}
                    ],
                    telPhone: [
                        {required: true, message: "手机号不能为空", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isPhoneValiate(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ],
                    certType: [
                        {required: true, message: "证件类型不能为空", trigger: "change"}
                    ],
                    certNo: [
                        {required: true, message: '证件号码不能为空', trigger: 'change'},
                        {
                            validator: (rule, value, callback) => {
                                utils.doValidID(rule, value, callback)
                            }, trigger: "change"
                        }
                    ],
                    birthday: [
                        {required: true, message: "出生年月不能为空", trigger: "change", type: "date"}
                    ],
                    domicLocation: [
                        {required: true, message: "户籍所在地不能为空", trigger: "change", type: "array"}
                    ],
                    maritalStatus: [
                        {required: true, message: "婚姻状况不能为空", trigger: "change"}
                    ],
                    sex: [{required: true, message: "性别不能为空", trigger: "change"}],
                    highestEducation: [
                        {required: true, message: "学历不能为空", trigger: "change"}
                    ],
                    nationality: [
                        {required: true, message: "国籍不能为空", trigger: "change"}
                    ],
                    unitName: [
                        {required: true, message: "单位名称不能为空", trigger: "blur"}
                    ],
                    unitNature: [
                        {required: true, message: "单位性质不能为空", trigger: "change"}
                    ],
                    industryType: [
                        {required: true, message: "行业类型不能为空", trigger: "change"}
                    ],
                    jobsType: [
                        {required: true, message: "职业类型不能为空", trigger: "change"}
                    ],
                    position: [
                        {required: true, message: "职务不能为空", trigger: "change"}
                    ],
                    outstandingLoan: [
                        {
                            validator: (rule, value, callback) => {
                                utils.isMoneyValue(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ],
                    totalIncome: [
                        {
                            validator: (rule, value, callback) => {
                                utils.isMoneyValue(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ],
                    monthlyIncome: [
                        {required: true, message: "本人月收入不能为空", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isMoneyValue(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ],
                    workAge: [
                        {required: true, message: "工作年限不能为空", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isCheckItOutForWorkAge(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ],
                    drivingType: [
                        {required: true, message: "驾驶证件不能为空", trigger: "blur"},
                    ],
                    drivingLicenceNo: [
                        // {required: true, message: "驾驶编号不能为空", trigger: "blur"},
                    ]
                },
                electorAuthFormRule: {
                    businessType: [
                        {required: true, message: "请至少选择一项", trigger: "change"}
                    ],
                    telPhone: [
                        {required: true, message: "手机号码值不能为空", trigger: "change"},
                        {validator: utils.isPhoneValiate, trigger: "change"}
                    ],
                    custName: [
                        {required: true, message: "客户姓名值不能为空", trigger: "change"},
                        {validator: utils.isNameValiate, trigger: "change"}
                    ],
                    certEndDate: [
                        {required: true, type: 'date', message: "身份证到期日值不能为空", trigger: "change"}
                    ],
                    certNo: [
                        {required: true, message: "证件号码值不能为空", trigger: "change"},
                        {validator: utils.doValidID, trigger: "change"}
                    ]
                },
                // 单独对证件到期日校验
                requeirCertEndDate: [
                    {required: true, message: "证件到期日不能为空", trigger: "change", type: 'date'}
                ],
                clearCertEndDate: [{required: false}],
                //联系人校验
                emerContactValidate: {},
                // 紧急联系人
                emerContactForm: {
                    contactinfo: [
                        {
                            id: "",
                            custRelation: "",
                            custName: "",
                            telPhone: "",
                            certType: "",
                            certNo: "",
                            companyName: "",
                            monthlyIncome: "",
                            detailAddressTemp: [],
                            inputDetail: ""
                        },
                        {
                            id: "",
                            custRelation: "",
                            custName: "",
                            telPhone: "",
                            certType: "",
                            certNo: "",
                            companyName: "",
                            monthlyIncome: "",
                            detailAddressTemp: [],
                            inputDetail: ""
                        }
                    ]
                },
                // 共借人对象
                commonBorrowerObj: {},
                //保证人对象
                bailObj: {},
                dataDic: {
                    //证件类型
                    certType: [],
                    //性别
                    sex: [],
                    //学历
                    highestEducation: [],
                    //国籍
                    nationality: [],
                    //婚姻状况
                    maritalStatus: [],
                    //驾驶证件
                    drivingType: [],
                    //单位性质
                    unitNature: [],
                    //行业类型
                    industryType: [],
                    //职业类型
                    jobsType: [],
                    //职务
                    position: [],
                    //地址类型
                    addressType: [],
                    //房产类型
                    houseType: [],
                    //与主借人关系
                    custRelation: [],
                },
                formData: {
                    businessNo: ""
                },
                workflowRecordList: [{
                    businessNo: "",
                    approveResult: ""
                }]
            };
        },
        components: {
            PlaceCascade,
            CommonBorrower,
            Bail,
            CardUpload
        },
        props: {
            isShowDetails: {
                type: Boolean,
            },
            applyNo: {
                type: String,
            },
            curTab: {
                type: Number,
            },
            tempBusinessType: {
                type: String
            },
            preApproveForm: {
                type: Object
            },
            remarkForm: {
                type: Object,
            },
            isOldCarDisabled: {
                type: Boolean,
            },
            isNewCarDisabled: {
                type: Boolean,
            },
            channelObj: {
                type: Object
            },
            preId: {
                type: String
            }
        },
        watch: {
            curTab(val) {
                if (val === 1) {
                    console.log(this.tempBusinessType, "业务类型")
                    if (this.tempBusinessType == '02') {
                        this.isShowDriverCertype = true;
                    }
                    this.applyNo ? (this.queryContactList(), this.queryCustomList(), this.getLocationData(), this.initDataDic()) : (this.getLocationData(), this.initDataDic());
                    if (this.customInfoForm.addressinfo[0].isDefault === false || this.customInfoForm.addressinfo[1].isDefault === false) {
                        this.customInfoForm.addressinfo[0].isDefault = true;
                        this.customInfoForm.addressinfo[0].isShow = true;
                    }
                    if (this.customInfoForm.certType == "00001") {
                        let lenValitate = this.customInfoValidate['certNo'].length - 1;
                        this.customInfoValidate['certNo'].splice(lenValitate, 1)
                    }
                }
            }
        },
        created() {
            this.initCheckValiate();
            this.initEmerCheckValiate();
            if (this.customInfoForm.certType == "00001") {
                this.customInfoValidate['certNo'].push({
                    validator: this.validID,
                    trigger: "blur"
                })
            }
            ;
        },
        mounted() {
        },
        methods: {
            queryZmInfo(data) {
                if (data) {
                    this.electorAuthForm.custName = data.name;
                    this.electorAuthForm.certNo = data.number;
                }
            },
            queryFmInfo(data) {
                if (data) {
                    this.electorAuthForm.certEndDate = data.validUntil;
                }
            },
            getDate() {
                if (this.customInfoForm.custName != '' && this.customInfoForm.certNo != '' && this.customInfoForm.telPhone != '' && (this.customInfoForm.certEndDate != '' || this.customInfoForm.isLongTerm == true)) {
                    console.log("监听进来了")
                    this.isNotCertNo = false;
                } else {
                    this.isNotCertNo = true;
                }
            },
            selectCheckBox(value) {
                if (value === true) {
                    this.customInfoForm.certEndDate = "";
                }
                if (this.customInfoForm.custName != '' && this.customInfoForm.certNo != '' && this.customInfoForm.telPhone != '' && (this.customInfoForm.certEndDate != '' || this.customInfoForm.isLongTerm == true)) {
                    console.log("监听进来了")
                    this.isNotCertNo = false;
                } else {
                    this.isNotCertNo = true;
                }
            },
            //删除地址信息
            deleteAddressInfo(v) {
                deleteAddressInfo(v).then(res => {
                    if (res.code === '0000') {
                        this.$Message.success("删除成功");
                    }
                })
            },
            //删除联系人信息
            deleteContectInfo(v) {
                deleteContectInfo(v).then(res => {
                    if (res.code === '0000') {
                        this.$Message.success("删除成功");
                    }
                })
            },
            //根据证件号，显示或清空生日和性别
            certNoChange() {
                if (this.customInfoForm.custName != '' && this.customInfoForm.certNo != '' && this.customInfoForm.telPhone != '' && (this.customInfoForm.certEndDate != '' || this.customInfoForm.isLongTerm == true)) {
                    this.isNotCertNo = false;
                } else {
                    this.isNotCertNo = true;
                }
                this.customInfoForm.certNo = this.customInfoForm.certNo.replace(/\s+/g, "");
                if (this.customInfoForm.certType == '00001') {
                    this.go(this.customInfoForm.certNo);
                }
            },
            //年龄计算
            countAge(v) {
                // console.log("生日:", v);
                v = formatDate(v, "yyyy-MM-dd")
                var birthdays = new Date(v.replace(/-/g, "/"));
                var d = new Date();
                var age = d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || (d.getMonth() == birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? 1 : 0);
                this.customInfoForm.age = age;
                // console.log("年龄:", this.customInfoForm.age)
            },
            //地址同上功能
            copyAddressValue(index) {
                let addressinfo = this.customInfoForm.addressinfo;
                if (addressinfo[index - 1].detailAddressTemp.length > 0) {
                    this.$set(addressinfo[index], "detailAddressTemp", addressinfo[index - 1].detailAddressTemp);
                }
                if (addressinfo[index - 1].inputDetail) {
                    addressinfo[index].inputDetail = addressinfo[index - 1].inputDetail
                }
            },
            singleSelectCertType(val) {
                if (val == "00001") {
                    this.customInfoValidate['certNo'].push({
                        validator: this.validID,
                        trigger: "change"
                    })
                    this.isNotCertNo = false;
                } else {
                    this.isNotCertNo = true;
                    this.customInfoValidate['certNo'].trigger = 'change';
                    let lenValitate = this.customInfoValidate['certNo'].length - 1;
                    this.customInfoValidate['certNo'].splice(lenValitate, 1)
                }
            },
            //地址删除功能
            deleteAddress(item, index) {
                if (index > 1) {
                    this.customInfoForm.addressinfo.splice(index, 1);
                    this.deleteAddressInfo(item);
                }
            },
            deleteContactInfo(item, index) {
                if (index > 1) {
                    this.emerContactForm.contactinfo.splice(index, 1);
                    this.deleteContectInfo(item);
                }
            },
            //选择已婚，关联显示联系人为夫妻
            changeContect(v) {
                //如果选择已婚，联系人第一条，夫妻
                if (v == '00001') {
                    console.log("已婚")
                    this.emerContactForm.contactinfo[0].custRelation = '00006';
                    this.emerContactForm.contactinfo[0].certType = '00001';
                    this.isCustRelation = true;
                    this.emerContactValidate["contactinfo[0].certType"] = [
                        {required: true, message: "证件类型不能为空", trigger: "change"},
                    ];
                    this.emerContactValidate["contactinfo[0].monthlyIncome"] = [
                        {required: true, message: "月收入不可为空", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isMoneyValue(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                    this.emerContactValidate["contactinfo[0].certNo"] = [
                        {required: true, message: "证件号码不能为空", trigger: "change"},
                        {
                            validator: (rule, value, callback) => {
                                utils.doValidID(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                    this.isDisabledCustRelation = true;
                } else if (v == '00002') {
                    console.log("未婚")
                    this.emerContactValidate["contactinfo[0].certType"] = [
                        {required: false, message: "证件类型不能为空", trigger: "change"},
                    ];
                    this.emerContactValidate["contactinfo[0].monthlyIncome"] = [
                        {required: false, message: "月收入不可为空", trigger: "blur"},
                    ];
                    //未婚不可选择夫妻
                    this.isDisabledCustRelation = true;
                    this.emerContactForm.contactinfo[0].custRelation = '';
                    this.emerContactForm.contactinfo[0].certType = '';
                    this.isCustRelation = false;
                } else if (v == '00003') {
                    console.log("离婚")
                    this.emerContactValidate["contactinfo[0].monthlyIncome"] = [
                        {required: false, message: "月收入不可为空", trigger: "blur"},
                    ];
                    this.emerContactValidate["contactinfo[0].certType"] = [
                        {required: false, message: "证件类型不能为空", trigger: "change"},
                    ];
                    this.emerContactValidate["contactinfo[0].certNo"] = [
                        {required: false, message: "证件号码不能为空", trigger: "change"},
                    ];
                    this.isDisabledCustRelation = true;
                    this.emerContactForm.contactinfo[0].certType = '';
                    this.emerContactForm.contactinfo[0].custRelation = '';
                    this.isCustRelation = false;
                } else if (v == '00004') {
                    console.log("丧偶")
                    this.emerContactValidate["contactinfo[0].monthlyIncome"] = [
                        {required: false, message: "月收入不可为空", trigger: "blur"},
                    ];
                    this.emerContactValidate["contactinfo[0].certType"] = [
                        {required: false, message: "证件类型不能为空", trigger: "change"},
                    ];
                    this.emerContactValidate["contactinfo[0].certNo"] = [
                        {required: false, message: "证件号码不能为空", trigger: "change"},
                    ];
                    //丧偶
                    this.isDisabledCustRelation = true;
                    this.emerContactForm.contactinfo[0].custRelation = '';
                } else if (v == '00005') {
                    console.log("其他", this.emerContactForm.contactinfo[0].custRelation)
                    if (this.emerContactForm.contactinfo[0].custRelation == '00006') {
                        this.isDisabledCustRelation = true;
                        this.isCustRelation = false;
                    } else {
                        //其他
                        this.isCustRelation = false;
                        this.isDisabledCustRelation = false;
                    }
                } else {
                    this.isCustRelation = false;
                    this.isDisabledCustRelation = false;
                }
            },
            checkCustRelation(v, index) {
                if (v === '00006') {
                    console.log("00006")
                    if (this.customInfoForm.maritalStatus == '00001') {
                        this.isCustRelation = true;
                    }
                    this.emerContactForm.contactinfo[0].certType = '00001';
                    this.emerContactValidate["contactinfo[0].certType"] = [
                        {required: true, message: "证件类型不能为空", trigger: "change"},
                    ];
                    this.emerContactValidate["contactinfo[0].monthlyIncome"] = [
                        {required: true, message: "月收入不可为空", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isMoneyValue(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                    this.emerContactValidate["contactinfo[0].certNo"] = [
                        {required: true, message: "证件号码不能为空", trigger: "change"},
                        {
                            validator: (rule, value, callback) => {
                                utils.doValidID(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                    //只可选择一个夫妻
                    this.isDisabledCustRelation = true;
                } else if ((typeof (v) == 'undefined') && this.customInfoForm.maritalStatus == '00005') {
                    console.log("其他", v)
                    this.isDisabledCustRelation = true;
                } else if (this.customInfoForm.maritalStatus == '00002') {
                    console.log("0002", v)
                    this.isDisabledCustRelation = true;
                } else if (this.customInfoForm.maritalStatus == '00003') {
                    console.log("0003", v)
                    this.isDisabledCustRelation = true;
                } else if (this.customInfoForm.maritalStatus == '00004') {
                    console.log("0004", v)
                    this.isCustRelation = false;
                    this.isDisabledCustRelation = true;
                } else {
                    console.log("空", v)
                    this.isDisabledCustRelation = false;
                }
            },
            //
            changeCertType(v, index) {
                console.log("证件类型:", v)
                //如果证件类型不为00001且不为空
                if (v == undefined) {
                    console.log("身份证进来了")
                    this.emerContactValidate["contactinfo[0].certNo"] = [
                        {required: false, message: "证件号码不能为空", trigger: "change"},
                    ];
                    if (this.customInfoForm.maritalStatus == '00002' || this.customInfoForm.maritalStatus == '00003' || this.customInfoForm.maritalStatus == '00004') {
                        this.isDisabledCustRelation = true;
                    }
                } else if (v != '00001') {
                    this.emerContactValidate["contactinfo[" + index + "].certNo"] = [
                        {required: false, message: "证件号码不能为空", trigger: "blur"},
                    ]
                } else if (v == '00001') {
                    this.emerContactValidate["contactinfo[" + index + "].certNo"] = [
                        {required: true, message: "证件号码不能为空", trigger: "change"},
                        {
                            validator: (rule, value, callback) => {
                                utils.doValidID(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ]
                }
            },
            // 身份证验证
            validID(rule, value, callback) {
                // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
                let reg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;
                if (reg.test(value)) {
                    if (this.customInfoForm.certType == '00001') {
                        this.go(value.length);
                    }
                    callback()
                } else {
                    callback(new Error('身份证号码不正确'))
                }
            },
            // 实现自动生成生日，性别，年龄
            go(val) {
                if (val === 18) {
                    val = 18
                } else if (val === 15) {
                    val = 15
                } else {
                    val = val.length
                }
                let iden = this.customInfoForm.certNo;
                let sex = null;
                let birth = null;
                let myDate = new Date();
                let month = myDate.getMonth() + 1;
                let day = myDate.getDate();
                let age = 0;
                if (val === 18) {
                    age = myDate.getFullYear() - iden.substring(6, 10) - 1;
                    sex = iden.substring(16, 17);
                    birth = iden.substring(6, 10) + "-" + iden.substring(10, 12) + "-" + iden.substring(12, 14);
                    if (iden.substring(10, 12) < month || iden.substring(10, 12) == month && iden.substring(12, 14) <= day) age++;
                }
                if (val === 15) {
                    age = myDate.getFullYear() - iden.substring(6, 8) - 1901;
                    sex = iden.substring(13, 14);
                    birth = "19" + iden.substring(6, 8) + "-" + iden.substring(8, 10) + "-" + iden.substring(10, 12);
                    if (iden.substring(8, 10) < month || iden.substring(8, 10) == month && iden.substring(10, 12) <= day) age++;
                }
                if (sex % 2 === 0)
                    sex = 'F';
                else
                    sex = 'M';
                this.customInfoForm.sex = sex;
                if (this.customInfoForm.certType == '00001') {
                    this.customInfoForm.birthday = new Date(birth);
                } else {
                    this.customInfoForm.birthday = null;
                }
                this.countAge(this.customInfoForm.birthday);
            },
            //中文转拼音
            spell() {
                if (this.customInfoForm.custName != '' && this.customInfoForm.certNo != '' && this.customInfoForm.telPhone != '' && (this.customInfoForm.certEndDate != '' || this.customInfoForm.isLongTerm == true)) {
                    console.log("监听进来了")
                    this.isNotCertNo = false;
                } else {
                    this.isNotCertNo = true;
                }
                this.customInfoForm.spellName = vPinyin.chineseToPinYin(this.customInfoForm.custName);
                this.$refs.customInfoForm.validateField('spellName');
            },
            isSignOk() {
                if (this.customInfoForm.custName != '' && this.customInfoForm.certNo != '' && this.customInfoForm.telPhone != '' && (this.customInfoForm.certEndDate != '' || this.customInfoForm.isLongTerm == true)) {
                    console.log("监听进来了")
                    this.isNotCertNo = false;
                } else {
                    this.isNotCertNo = true;
                }
            },
            // 查询数据字典
            initDataDic() {
                this.initGetAllDicData();
            },
            //设置邮寄地址
            setIsDefault(index) {
                if (this.customInfoForm.addressinfo[index].isShow === true) {
                    this.customInfoForm.addressinfo[index].isDefault = true
                } else if (this.customInfoForm.addressinfo[index].isShow === false) {
                    this.customInfoForm.addressinfo[index].isDefault = false
                }
                if (this.customInfoForm.addressinfo[index].isDefault === false) {
                    if (index <= 0) {
                        this.customInfoForm.addressinfo[index + 1].isDefault = false;
                        this.customInfoForm.addressinfo[index + 1].isShow = false;
                        this.customInfoForm.addressinfo[index].isDefault = true;
                        this.customInfoForm.addressinfo[index].isShow = true;
                    }
                    if (index >= 1) {
                        this.customInfoForm.addressinfo[index - 1].isDefault = false;
                        this.customInfoForm.addressinfo[index - 1].isShow = false;
                        this.customInfoForm.addressinfo[index].isDefault = true;
                        this.customInfoForm.addressinfo[index].isShow = true;
                    }
                } else if (this.customInfoForm.addressinfo[index - 1].isDefault === true || this.customInfoForm.addressinfo[index - 1] === '') {
                    this.customInfoForm.addressinfo[index - 1].isDefault = false;
                    this.customInfoForm.addressinfo[index - 1].isShow = false;
                    this.customInfoForm.addressinfo[index].isDefault = true;
                    this.customInfoForm.addressinfo[index].isShow = true;
                } else if (this.customInfoForm.addressinfo[index + 1].isDefault === true || this.customInfoForm.addressinfo[index + 1] === '') {
                    this.customInfoForm.addressinfo[index + 1].isDefault = false;
                    this.customInfoForm.addressinfo[index + 1].isShow = false;
                    this.customInfoForm.addressinfo[index].isDefault = true;
                    this.customInfoForm.addressinfo[index].isShow = true;
                }
                //更改按钮颜色
                this.$Message.success('邮寄地址设置成功');
            },
            //批量获取数据字典
            initGetAllDicData() {
                //数据字典
                let arr = ["houseType", "addressType", "position", "jobsType", "industryType", "unitNature", "drivingType",
                    "maritalStatus", "nationality", "highestEducation", "sex", "certType", "custRelation", "", ""];
                getByTypes(arr).then(res => {
                    if (res.code === "0000") {
                        this.dataDic = deepClone(res.data);
                    }
                });
            },
            // 获取联系人地址
            queryContactList() {
                if (this.applyNo != null && this.applyNo !== "") {
                    let param = "";
                    param = {
                        applyNo: this.applyNo,
                    }
                    getContactList(param).then(res => {
                        if (res.code === "0000") {
                            let cloneList = deepClone(res.data.contactsList);
                            let listArray = [];
                            let addressInfo = '';
                            if (cloneList && cloneList.length > 0) {
                                cloneList.forEach((item, index) => {
                                    addressInfo = item.livingProvince + "," + item.livingCity;
                                    if (item.custRelation == '00006') {
                                        this.isDisabledCustRelation = true;
                                    }
                                    console.log(item.certType, "联系人证件")
                                    if (item.certType != '00001' && typeof (item.certType) != 'undefined' && item.certType != '' && item.certType != null) {
                                        this.emerContactValidate["contactinfo[" + index + "].certNo"] = [
                                            {required: true, message: "证件号码不能为空", trigger: "blur"},
                                        ]
                                    }
                                    let obj = {
                                        id: item.id,
                                        custRelation: item.custRelation,
                                        custName: item.custName,
                                        telPhone: item.telPhone,
                                        certType: item.certType,
                                        certNo: item.certNo,
                                        companyName: item.companyName,
                                        monthlyIncome: item.monthlyIncome,
                                        detailAddressTemp: addressInfo.split(","),
                                        inputDetail: item.detailAddress
                                    };
                                    if (item.monthlyIncome != undefined) {
                                        obj.monthlyIncome = obj.monthlyIncome.toString();
                                    }
                                    listArray.push(obj);
                                });
                                this.emerContactForm.contactinfo = listArray;
                            }
                        }
                    });
                }
            },
            // 电子授权
            tagEleAuth() {
                if (this.customInfoForm.signFailNumber == 3) {
                    this.$Message.error("电子授权失败次数超过3次，请纸质签署征信授权书文件");
                    return;
                }
                this.editelectorAuthModel = true;
                this.electorAuthForm.businessType = this.tempBusinessType;
                this.electorAuthForm.telPhone = this.customInfoForm.telPhone;
                this.electorAuthForm.custName = this.customInfoForm.custName;
                this.electorAuthForm.certEndDate = this.customInfoForm.certEndDate || "9999-12-31";
                this.electorAuthForm.certNo = this.customInfoForm.certNo;
                let self = this;
                console.log(this.electorAuthForm.businessType, "电子授权")
                this.$nextTick(function () {
                    self.$refs.editcarUpload.resetimgurl();
                    self.$refs.editcarUpload.showCarImg(this.applyNo);
                })
                // 预审批通过
                if (this.signResult && this.signResult == "1") {
                    this.isPass = true;
                    //预审批没通过
                } else {
                    this.isPass = false;
                }
            },
            submit() {
                this.binary = '';
                if (this.refreshTime !== '') {
                    this.destroyed();
                }
                let certEndDate = formatDate(this.electorAuthForm.certEndDate, "yyyy-MM-dd")
                let param = {
                    applyNo: this.applyNo,
                    businessType: this.electorAuthForm.businessType,
                    telPhone: this.electorAuthForm.telPhone,
                    custName: this.electorAuthForm.custName,
                    certEndDate: certEndDate,
                    certNo: this.electorAuthForm.certNo,
                    custRole: '01',
                }
                //影像入参数
                let data = this.queryParam(param, 'edit');
                if (!data) {
                    this.$Message.warning("请上传身份证正反面");
                    return;
                }
                updateSignParams(param).then(res => {
                    if (res.code == "0000") {
                        this.customInfoForm.certNo = param.certNo;
                        this.customInfoForm.telPhone = param.telPhone;
                        this.customInfoForm.custName = param.custName;
                        this.customInfoForm.spellName = vPinyin.chineseToPinYin(param.custName);
                        this.codeName = "刷新二维码";
                        this.binary = res.data[1].code;
                        this.isDisabled = false;
                    }
                })
            },
            editTurnBack() {
                this.editelectorAuthModel = false;
                this.binary = '';
                this.destroyed();
            },
            cancel() {
                this.editelectorAuthModel = false;
                this.binary = '';
                this.destroyed();
            },
            destroyed() {
                // 清除定时器
                clearInterval(this.countDown)
                this.countDown = null;
            },
            //刷新二维码信息,并更新数据
            refreshQrCode() {
                let v = {};
                this.countDown = setInterval(() => {
                    //如果刷新时间为空，那么就可以点击刷新
                    if (this.refreshTime === '') {
                        this.isDisabled = false;
                        this.codeName = "刷新二维码";
                        this.binary = '';
                        v = {
                            id: this.customInfoForm.id,
                            custRole: '01',
                        }
                        //点击刷新
                        refresh(v).then(res => {
                            if (res.code === '0000') {
                                this.binary = '';
                                this.$Message.success("刷新成功");
                                this.refreshTime = res.data.activeTime;
                                this.binary = res.data.code;
                            }
                        })
                    } else {
                        this.isDisabled = true;
                        this.codeName = this.refreshTime-- + 's后再次刷新';
                        // console.log(this.codeName, "this.codeName ")
                    }
                }, 1800);
            },
            // 查询影像上传入参数
            queryParam(datas, type) {
                let imgList = "";
                if (type == 'edit') {
                    imgList = this.$refs.editcarUpload.devierimglist();
                }
                // console.log(imgList, "imgList")
                if (imgList.length < 2) {
                    return false;
                }
                if (imgList.length > 0) {
                    let tempArr = [];
                    imgList.forEach((item, index) => {
                        tempArr.push(item.map)
                    })
                    datas.contractFileVos = tempArr;
                }
                return true
            },
            // 查询客户信息列表
            queryCustomList(custRole) {
                let param = "";
                param = {
                    applyNo: this.applyNo,
                    custRole: custRole,
                    businessType: this.tempBusinessType,
                };
                if (this.customInfoForm.id === null || this.customInfoForm.id === '') {
                    this.$emit('isLoading', true);
                }
                //根据条件获取客户信息
                getCustomerList(param).then(res => {
                    if (res.code === "0000") {
                        this.$emit('isLoading', false);
                        let custList = [];
                        let isSuggestRejectF = '';
                        let isSendBackToDealer = '';
                        let isBack = '';
                        for (let i = 0; i < res.data.length; i++) {
                            custList.push(res.data[i]);
                            isSuggestRejectF = res.data[i].isSuggestRejectF;
                            isBack = res.data[i].isBack;
                            isSendBackToDealer = res.data[i].isSendBackToDealer;
                        }
                        if (isSuggestRejectF == 'yes') {
                            console.log("玄武退回")
                            this.isSuggestRejectF = true;
                        }
                        if (isBack == 'yes') {
                            console.log("常规退回", isBack)
                            this.isBack = true;
                        }
                        if (isSendBackToDealer == 'yes') {
                            console.log("退回经销商", isSendBackToDealer)
                            this.isSendBackToDealer = true;
                        }
                        if (custList.length <= 0) {
                            return;
                        }
                        //拿取客户户籍地址
                        let addressList = deepClone(custList[0].addressList);
                        console.log("地址信息:", addressList)
                        if (addressList !== undefined && addressList.length > 0) {
                            this.customInfoForm.domicLocation[0] = addressList[0].province;
                            this.customInfoForm.domicLocation[1] = addressList[0].city;
                            this.customInfoForm.personalAddressId = addressList[0].id;
                            this.customInfoForm.permanentAdreess[0] = addressList[0].province;
                            this.customInfoForm.permanentAdreess[1] = addressList[0].city;
                        }
                        for (let i = 0; i < custList.length; i++) {
                            let custBaseInfo = [];
                            let personalInfo = [];
                            let addressList = [];
                            //------主---------借----------人----
                            if (custList[i].custBaseInfo.custRole === "01") {
                                // 预审批结果
                                this.signResult = custList[i].custBaseInfo.signResult;
                                //主借人基本信息
                                custBaseInfo = custList[i].custBaseInfo;
                                this.customInfoForm.id = custBaseInfo.id || "";
                                this.customInfoForm.applyNo = custBaseInfo.applyNo || "";
                                this.customInfoForm.custName = custBaseInfo.custName || "";
                                this.customInfoForm.telPhone = custBaseInfo.telPhone || "";
                                this.customInfoForm.signFailNumber = custBaseInfo.signFailNumber || 0;
                                this.customInfoForm.custRole = custBaseInfo.custRole || "";
                                this.customInfoForm.certType = custBaseInfo.certType || "";
                                this.customInfoForm.certNo = custBaseInfo.certNo || "";
                                this.customInfoForm.isLock = custBaseInfo.isLock || "";
                                this.customInfoForm.riskQueriedFlag = custBaseInfo.riskQueriedFlag;
                                //解决isLongTerm返回String不是Boolean问题
                                if (custBaseInfo.isLongTerm === false || custBaseInfo.isLongTerm === "false" && custBaseInfo.certEndDate !== '') {
                                    this.customInfoForm.isLongTerm = false;
                                    this.customInfoForm.certEndDate = new Date(custBaseInfo.certEndDate) || null;
                                } else if (custBaseInfo.isLongTerm === true || custBaseInfo.isLongTerm === "true") {
                                    this.customInfoForm.isLongTerm = true;
                                    this.customInfoForm.certEndDate = null;
                                }
                                //主借人个人明细信息
                                personalInfo = custList[i].personalInfo;
                                if (personalInfo !== undefined) {
                                    this.customInfoForm.spellName = personalInfo.spellName || "";
                                    this.customInfoForm.birthday = personalInfo.birthday || "";
                                    this.customInfoForm.maritalStatus = personalInfo.maritalStatus || "";
                                    this.customInfoForm.sex = personalInfo.sex || "";
                                    this.customInfoForm.position = personalInfo.position || "";
                                    this.customInfoForm.highestEducation = personalInfo.highestEducation || "";
                                    this.customInfoForm.nationality = personalInfo.nationality || "";
                                    this.customInfoForm.drivingType = personalInfo.drivingType || "";
                                    this.customInfoForm.drivingLicenceNo = personalInfo.drivingLicenceNo || "";
                                    this.customInfoForm.unitName = personalInfo.unitName || "";
                                    this.customInfoForm.unitNature = personalInfo.unitNature || "";
                                    this.customInfoForm.industryType = personalInfo.industryType || "";
                                    this.customInfoForm.jobsType = personalInfo.jobsType || "";
                                    this.customInfoForm.companyPhone = personalInfo.companyPhone || "";
                                    this.customInfoForm.monthlyIncome = personalInfo.monthlyIncome.toString() || "";
                                    this.customInfoForm.totalIncome = personalInfo.totalIncome || "";
                                    this.customInfoForm.outstandingLoan = personalInfo.outstandingLoan || "";
                                    this.customInfoForm.workAge = personalInfo.workAge || "";
                                    this.customInfoForm.personalId = personalInfo.id || "";
                                    if (personalInfo.maritalStatus == "00001") {
                                        this.isCustRelation = true;
                                    } else {
                                        this.isCustRelation = false;
                                    }
                                }
                                if (this.customInfoForm.certType !== "00001") {
                                    this.isNotCertNo = true;
                                    let lenValitate = this.customInfoValidate['certNo'].length - 1;
                                    this.customInfoValidate['certNo'].splice(lenValitate, 1)
                                }
                                //复议锁
                                if (this.customInfoForm.isLock == '1') {
                                    this.isReconsider = true;
                                } else if (this.customInfoForm.isLock == undefined) {
                                    this.isReconsider = '0';
                                }
                                if (this.customInfoForm.birthday != undefined) {
                                    this.countAge(this.customInfoForm.birthday);
                                    this.customInfoForm.birthday = new Date(this.customInfoForm.birthday);
                                }
                                if (this.customInfoForm.monthlyIncome != undefined && personalInfo != undefined) {
                                    this.customInfoForm.monthlyIncome = personalInfo.monthlyIncome.toString();
                                }
                                if (this.customInfoForm.maritalStatus == '00002') {
                                    this.isDisabledCustRelation = true;
                                }
                                //主借人地址信息
                                addressList = deepClone(custList[i].addressList);
                                if (addressList != undefined) {
                                    let addressArr = [];
                                    //删除地址数组中的第一个数组，因为，第一个数组是客户基本信息内的户籍地址,然后，放入addressInfo中的才是需要的地址信息
                                    let arrayShift = this.$delete(addressList, 0);
                                    addressList.forEach((item, index) => {
                                        let addressId = item.id;
                                        let detailAddressTemp = item.province + "," + item.city;
                                        let obj = {
                                            id: addressId,
                                            addressType: item.addressType,
                                            detailAddressTemp: detailAddressTemp.split(","),
                                            inputDetail: item.detailAddress,
                                            houseType: item.houseType,
                                            houseStartDate: new Date(item.houseStartDate),
                                            isDefault: eval(item.isDefault),
                                            isShow: false,
                                        };
                                        if (obj.isDefault) {
                                            obj.isShow = true;
                                        } else {
                                            obj.isShow = false;
                                        }
                                        addressArr.push(obj);
                                    });
                                    this.customInfoForm.addressinfo = addressArr;
                                }
                            } else if (custList[i].custBaseInfo.custRole === "02") {
                                //共----借-----人
                                this.commonBorrowerObj = custList[i];
                            } else if (custList[i].custBaseInfo.custRole === "03") {
                                //担----保-----人
                                this.bailObj = custList[i];
                            }
                        }
                    }
                });
            },
            getLocationData() {
                let param = ""
                param = {
                    level: '1',
                    upperCode: '1'
                };
                getLocation(param).then((res) => {
                    if (res.code === "0000") {
                        res.data.forEach(item => {
                            // 表明是否是父节点
                            if (item.isParent) {
                                item.loading = false;
                                item.children = [];
                            }
                        })
                    }
                    this.location.push(...res.data);
                })
            },
            loadData(item, callback) {
                item.loading = true;
                getLocation({upperCode: item.value}).then(res => {
                    if (res.code === "0000") {
                        res.data.forEach(function (item) {
                            if (item.isParent) {
                                item.loading = false;
                                item.children = [];
                            }
                        });
                        item.children = res.data;
                        item.loading = false;
                        callback();
                    }
                })
            },
            // 新增地址
            addLocation() {
                let obj = {
                    addressType: "",
                    detailAddressTemp: [],
                    inputDetail: "",
                };
                this.customInfoForm.addressinfo.push(obj);
                this.dynamicCheckValiate(this.customInfoForm);
            },
            initIdType() {

            },
            // 动态地址校验
            dynamicCheckValiate(form) {
                this.customInfoValidate[
                "addressinfo[" + (form.addressinfo.length - 1) + "].detailAddressTemp"
                    ] = [{required: true, message: "请选择详细地址", trigger: "change", type: "array"}];
                this.customInfoValidate[
                "addressinfo[" + (form.addressinfo.length - 1) + "].addressType"
                    ] = [{required: true, message: "请选择地址类型", trigger: "change"}];

            },
            // 初始化详细地址校验
            initCheckValiate() {
                for (let i = 0; i < this.customInfoForm.addressinfo.length; i++) {
                    this.customInfoValidate["addressinfo[" + i + "].addressType"] = [
                        {required: true, message: "请选择地址类型", trigger: "change"}
                    ];
                    this.customInfoValidate["addressinfo[" + i + "].detailAddressTemp"] = [
                        {required: true, message: "请选择详细地址", trigger: "change", type: "array"}
                    ];
                    if (i == 0) {
                        this.customInfoValidate["addressinfo[" + i + "].addressType"] = [
                            {required: true, message: "请选择地址类型", trigger: "change"}
                        ];
                        this.customInfoValidate["addressinfo[" + i + "].houseType"] = [
                            {required: true, message: "请选择房产类型", trigger: "change"}
                        ];
                        this.customInfoValidate["addressinfo[" + i + "].houseStartDate"] = [
                            {required: true, message: "请选择房产起始时间", trigger: "change", type: "date"}
                        ];
                    }
                }
            },
            // 新增联系人
            addContactInfo() {
                let obj = {
                    custRelation: "",
                    custName: "",
                    telPhone: "",
                    certType: "",
                    certNo: "",
                    companyName: "",
                    monthlyIncome: "",
                    detailAddressTemp: []
                };
                this.emerContactForm.contactinfo.push(obj);
                this.dynamicEmerCheckValiate(this.emerContactForm);
            },
            // 动态校验联系人
            dynamicEmerCheckValiate(form) {
                this.emerContactValidate["contactinfo[" + (form.contactinfo.length - 1) + "].custRelation"] = [
                    {required: true, message: "请选择与主借人关系", trigger: "change"}
                ];
                this.emerContactValidate["contactinfo[" + (form.contactinfo.length - 1) + "].monthlyIncome"] = [
                    {
                        validator: (rule, value, callback) => {
                            utils.isMoneyValue(rule, value, callback)
                        }, trigger: "blur"
                    }
                ];
                this.emerContactValidate["contactinfo[" + (form.contactinfo.length - 1) + "].custName"] = [
                    {required: true, message: "请输入姓名", trigger: "blur"},
                    {
                        validator: (rule, value, callback) => {
                            utils.isNameValiate(rule, value, callback)
                        }, trigger: "blur"
                    }
                ];
                this.emerContactValidate["contactinfo[" + (form.contactinfo.length - 1) + "].telPhone"] = [
                    {required: true, message: "请输入手机号", trigger: "blur"},
                    {
                        validator: (rule, value, callback) => {
                            utils.isPhoneValiate(rule, value, callback)
                        }, trigger: "blur"
                    }];
            },
            // 初始紧急联系人校验
            initEmerCheckValiate() {
                for (let i = 0; i < this.emerContactForm.contactinfo.length; i++) {
                    this.emerContactValidate["contactinfo[" + i + "].custRelation"] = [
                        {required: true, message: "请选择与主借人关系", trigger: "change"}
                    ];
                    this.emerContactValidate["contactinfo[" + i + "].monthlyIncome"] = [
                        {
                            validator: (rule, value, callback) => {
                                utils.isMoneyValue(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                    this.emerContactValidate["contactinfo[" + i + "].custName"] = [
                        {required: true, message: "请输入姓名", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isNameValiate(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                    this.emerContactValidate["contactinfo[" + i + "].telPhone"] = [
                        {required: true, message: "请输入手机号", trigger: "blur"},
                        {
                            validator: (rule, value, callback) => {
                                utils.isPhoneValiate(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                    this.emerContactValidate["contactinfo[" + i + "].certNo"] = [
                        {
                            validator: (rule, value, callback) => {
                                utils.doValidID(rule, value, callback)
                            }, trigger: "blur"
                        }
                    ];
                }
            },
            validateAll(callback) {
                let self = this;
                Promise.all([Promise.resolve(self.$refs.customInfoForm.validate()), Promise.resolve(self.$refs.emerContactForm.validate())])
                    .then((validaes) => {
                        callback(validaes.filter(item => {
                            return !item
                        }).length == 0);
                    })
            },
            //联系人手机号/证件号/姓名不可重复
            checkContect(v) {
                console.log("联系人数据:", v)
                //联系人信息不能为空
                if (v.length < 2) {
                    this.$Message.error("联系人信息不可少于两条");
                    return;
                }
                let a = {};
                let b = {};
                for (let i = 0; i < v.length; i++) {
                    a = v[i];
                    for (let j = i + 1; j < v.length; j++) {
                        b = v[j];
                        console.log("a", a);
                        console.log("b", b);
                        if (a.custName == b.custName) {
                            this.$Message.error("联系人姓名不可重复");
                            console.log(a.custName, "/", b.custName)
                            return false;
                        } else if (a.telPhone == b.telPhone) {
                            this.$Message.error("联系人电话不可重复");
                            return false;
                        } else if (a.certNo != '' && b.certNo != '') {
                            if (a.certNo == b.certNo) {
                                this.$Message.error("联系人证件号不可重复");
                                return false;
                            }
                        }
                    }

                }
            },
            /**
             * 保存客户信息
             * @param type
             * @param name
             */
            checkCustomInfo(type, name, btnType) {
                this.customInfoForm.monthlyIncome = this.customInfoForm.monthlyIncome;
                this.validateAll((pass) => {
                    if (!pass) {
                        this.$Message.warning("数据录入不正确");
                        this.errorTipScorll('customInfoForm');
                        // 当第一个customInfoForm校验通过在校验第二个emerContactForm滚动
                        this.$refs.customInfoForm.validate((valid) => {
                            if (valid) {
                                this.errorTipScorll('emerContactForm');
                            }
                        })
                        if (btnType == "nextBtn") {
                            this.$emit("valiateCustomRes", false)
                        }
                        return;
                    }
                    if (this.emerContactForm.contactinfo.isDefault === null) {
                        this.$Message.error("未选择默认邮寄地址");
                        if (btnType == "nextBtn") {
                            this.$emit("valiateCustomRes", false)
                        }
                        return;
                    }
                    //联系人信息重复校验
                    let b = this.checkContect(this.emerContactForm.contactinfo);
                    if (b == false) {
                        if (btnType == "nextBtn") {
                            this.$emit("valiateCustomRes", false)
                        }
                        return;
                    }
                    let s = '';
                    if (this.customInfoForm.certEndDate !== null && this.customInfoForm.certEndDate !== '') {
                        if (this.customInfoForm.certEndDate < new Date) {
                            this.$Message.error("证件到期日必须大于当前时间");
                            if (btnType == "nextBtn") {
                                this.$emit("valiateCustomRes", false)
                            }
                            return;
                        }
                        this.customInfoForm.certEndDate = formatDate(this.customInfoForm.certEndDate, "yyyy-MM-dd");
                        // console.log("证件到期日", this.customInfoForm.certEndDate)
                    }
                    this.customInfoForm.birthday = formatDate(this.customInfoForm.birthday, 'yyyy-MM-dd');
                    if (this.customInfoForm.addressinfo[0].houseType !== null || this.customInfoForm.addressinfo[0].houseType !== '') {
                        if (this.customInfoForm.addressinfo[0].houseStartDate > new Date) {
                            this.$Message.error("房产起始时间不可大于当前时间");
                            if (btnType == "nextBtn") {
                                this.$emit("valiateCustomRes", false)
                            }
                            return;
                        }
                    }
                    if (this.customInfoForm.certEndDate === null || this.customInfoForm.certEndDate === '') {
                        let date = '9999-12-31';
                        this.customInfoForm.certEndDate = date;
                        // console.log("证件到期日,长期", this.customInfoForm.certEndDate);
                    }
                    // console.log("出生日期:", this.customInfoForm.birthday);
                    let param = {
                        applyNo: this.applyNo,
                        custRole: type,
                        remarks: this.remarkForm.remark,
                        //客户基础信息
                        applyCustBaseInfo: {
                            id: this.customInfoForm.id,
                            applyNo: this.applyNo,
                            custType: this.customInfoForm.custType, //客户类型
                            custName: this.customInfoForm.custName, //客户姓名
                            telPhone: this.customInfoForm.telPhone, //手机号码
                            certType: this.customInfoForm.certType, //证件类型
                            certNo: this.customInfoForm.certNo, //证件编号
                            isLongTerm: this.customInfoForm.isLongTerm, //是否长期
                            certStartDate: this.customInfoForm.certStartDate,
                            certEndDate: this.customInfoForm.certEndDate, //证件失效日期
                            custRole: this.customInfoForm.custRole, //案件角色
                            custRelation: this.customInfoForm.custRelation //与申请人关系
                        },
                        //个人信息
                        personalDetail: {
                            id: this.customInfoForm.personalId,//个人信息id
                            personalAddressId: this.customInfoForm.personalAddressId,//户籍地址id
                            applyNo: this.applyNo,
                            permanentAdreess: this.customInfoForm.domicLocation,
                            spellName: this.customInfoForm.spellName, //姓名拼音
                            birthday: this.customInfoForm.birthday, //生日
                            maritalStatus: this.customInfoForm.maritalStatus, //婚姻状况
                            sex: this.customInfoForm.sex, //性别
                            age: this.customInfoForm.age,//年龄
                            highestEducation: this.customInfoForm.highestEducation, //最高学历
                            nationality: this.customInfoForm.nationality, //国籍
                            drivingType: this.customInfoForm.drivingType, //驾驶证件
                            drivingLicenceNo: this.customInfoForm.drivingLicenceNo, //驾驶证件号码
                            unitName: this.customInfoForm.unitName, //单位名称
                            unitNature: this.customInfoForm.unitNature, //单位性质
                            industryType: this.customInfoForm.industryType, //行业类型
                            jobsType: this.customInfoForm.jobsType, //职业类型
                            position: this.customInfoForm.position,//职位
                            companyPhone: this.customInfoForm.companyPhone, //公司电话
                            monthlyIncome: this.customInfoForm.monthlyIncome, //月收入
                            totalIncome: this.customInfoForm.totalIncome, //家庭总收入
                            outstandingLoan: this.customInfoForm.outstandingLoan, //未结清贷款
                            workAge: this.customInfoForm.workAge, //工作年限
                            addressType: this.customInfoForm.addressType //地址类型
                        }
                    };
                    // 构造地址数据
                    let tempAdress = [];
                    for (let i = 0; i < this.customInfoForm.addressinfo.length; i++) {
                        let obj = {
                            id: this.customInfoForm.addressinfo[i].id,
                            addressType: this.customInfoForm.addressinfo[i].addressType,
                            houseType: this.customInfoForm.addressinfo[i].houseType,
                            houseStartDate: this.customInfoForm.addressinfo[i].houseStartDate,
                            detailAddress: this.customInfoForm.addressinfo[i].inputDetail,
                            detailAddressTemp: this.customInfoForm.addressinfo[i].detailAddressTemp,
                            isDefault: this.customInfoForm.addressinfo[i].isDefault,
                        }
                        tempAdress.push(obj);
                    }
                    param.addressDetailsList = tempAdress;
                    // 构造紧急联系人信息
                    let tempContact = [];
                    for (let i = 0; i < this.emerContactForm.contactinfo.length; i++) {
                        let obj = {
                            id: this.emerContactForm.contactinfo[i].id,
                            custRelation: this.emerContactForm.contactinfo[i].custRelation,
                            certNo: this.emerContactForm.contactinfo[i].certNo,
                            custName: this.emerContactForm.contactinfo[i].custName,
                            telPhone: this.emerContactForm.contactinfo[i].telPhone,
                            certType: this.emerContactForm.contactinfo[i].certType,
                            companyName: this.emerContactForm.contactinfo[i].companyName,
                            monthlyIncome: this.emerContactForm.contactinfo[i].monthlyIncome,
                            detailAddress: this.emerContactForm.contactinfo[i].inputDetail,
                            detailAddressTemp: this.emerContactForm.contactinfo[i].detailAddressTemp,
                        }
                        tempContact.push(obj);
                    }
                    param.custContactsList = tempContact;
                    for (let i = 0; i < this.emerContactForm.contactinfo.length; i++) {
                        if (this.emerContactForm.contactinfo[i].certNo === this.customInfoForm.certNo) {
                            this.$emit('isLoading', false);
                            if (btnType == "nextBtn") {
                                this.$emit("valiateCustomRes", false)
                            }
                            return this.$Message.error("联系人证件号码不可与主借人重复");
                        } else if (this.emerContactForm.contactinfo[i].custRelation === '01') {
                            if (this.emerContactForm.contactinfo[i + 1].custRelation === '01') {
                                if (btnType == "nextBtn") {
                                    this.$emit("valiateCustomRes", false)
                                }
                                return this.$Message.error("在中国,一夫多妻制是不被允许的");
                            } else if (typeof this.emerContactForm.contactinfo[i + 1].custRelation === 'undefined') {
                                continue;
                            }
                        }
                    }
                    this.$emit('isLoading', true);
                    if (this.customInfoForm.id != null && this.customInfoForm.id !== "" || this.customInfoForm.id.length > 0) {
                        updateCustomerInfo(param).then(res => {
                            this.$emit('isLoading', false);
                            if (res.code === "0000") {
                                //保存成功返回客户信息页面
                                if (btnType == "nextBtn") {
                                    this.$emit("valiateCustomRes", true)
                                }
                                if (btnType == 'cutTable') {
                                    this.$emit('customCallSuccess', true)
                                }
                                this.$emit("close-model", false);
                                // this.$emit('queryInfo', this.personalType);
                                if (this.customInfoForm.certEndDate <= new Date('9999-12-31') && this.customInfoForm.isLongTerm == true) {
                                    this.customInfoForm.certEndDate = null;
                                }
                                if (this.customInfoForm.birthday != null) {
                                    this.customInfoForm.birthday = new Date(this.customInfoForm.birthday);
                                }
                                this.$Message.success("更新成功");
                                this.queryCustomList();
                                this.queryContactList();
                            }
                        }).catch(() => {
                            this.$emit('isLoading', false);
                        });
                    } else {
                        //保存客户信息
                        saveCustomerInfo(param).then(res => {
                            this.$emit('isLoading', false);
                            if (btnType == "nextBtn") {
                                this.$emit("valiateCustomRes", true)
                            }
                            if (res.code === "0000") {
                                this.$Message.success("保存成功");
                                this.customInfoForm.id = res.data.id;
                                if (this.customInfoForm.certEndDate <= new Date('9999-12-31') && this.customInfoForm.isLongTerm == true) {
                                    this.customInfoForm.certEndDate = null;
                                }
                                if (this.customInfoForm.birthday != null) {
                                    this.customInfoForm.birthday = new Date(this.customInfoForm.birthday);
                                }
                                this.queryCustomList();
                                this.queryContactList();
                            }
                        }).catch(() => {
                            this.$emit('isLoading', false);
                        });
                    }

                })
            },
            // 错误信息提示滚动
            errorTipScorll(name) {
                for (let i in this.$refs[name].fields) {
                    if (this.$refs[name].fields[i].validateState === "error") {
                        this.$refs[name].fields[i].$el.scrollIntoView({
                            block: "center",
                            behavior: "smooth",
                            inline: "center"
                        });
                        break;
                    }
                }
            },
            // 从子组件点击保存后触发的父组件事件
            queryInfo(personalType) {
                this.queryCustomList(personalType)
            }
        }
    };
</script>
<style>
    .editElector .img_wp:first-child {
        margin-left: 120px;
    }

    .show_cascader_detail .ivu-form-item-content {
        margin-top: 4px;
    }
</style>
<style scoped lang="less">
    .emerContact > .contactinfo {
        border: 1px solid #dcdee2;
        margin-bottom: 20px;
        padding-top: 10px;
    }

    .emerContact > .contactinfo:last-child {
        margin-bottom: 30px;
    }

    .required {
        display: inline-block;
        margin-right: 4px;
        line-height: 1;
        font-family: SimSun;
        font-size: 12px;
        color: #ed4014;
        font-weight: normal;
    }

    .labelRequired {
        display: inline-block;
        margin-right: 4px;
        line-height: 1;
        font-family: SimSun;
        font-size: 12px;
        color: #ed4014;
        font-weight: normal;
    }

    .customInfo {
        .ivu-btn-dashed {
            border-color: #EB9620;
            color: #EB9620;
        }

        /deep/ .ivu-collapse-simple {
            border: none;
        }

        /deep/ .ivu-collapse-item {
            border: none;
        }

        /deep/ .ivu-collapse-header {
            background-color: #F0EEEB;
            font-weight: 500;
            color: #232323;
            font-size: 13px;
            margin: 0 10px;
            height: 35px;
            line-height: 35px;
            padding-right: 10px;
        }

        /deep/ .ivu-collapse .ivu-collapse-header .ivu-icon-ios-arrow-forward {
            margin-right: 10px;
        }

        /deep/ .ivu-collapse .ivu-collapse-header .ivu-icon-ios-arrow-forward:before {
            content: '';
            display: inline-block;
            width: 7px;
            height: 13px;
            background-repeat: no-repeat;
            background-size: 100%;
            background-image: url("");
        }

        .panel-head-right {
            color: #EB9620;
            font-weight: normal;
            display: inline-block;
            width: 40px;
            text-align: center;
            cursor: pointer;
            line-height: 21px;
            float: right;
            margin-top: 7px;
        }

        .panel-head-right:hover {
            background: rgba(235, 150, 32, 0.25);
        }
    }

    .customInfo button i {
        width: 15px;
        height: 15px;
        display: inline-block;
        background-color: #EB9620;
        color: white;
        border-radius: 50%;
        line-height: 15px;
        margin-left: 5px;
    }

    .electorAuthForm {
        .ivu-date-picker,
        .ivu-select,
        .ivu-input,
        .ivu-checkbox-group,
        .ivu-input-wrapper {
            width: 100%;
            max-width: 200px;
        }
    }

    .uploadInfo > label {
        color: #333;
        display: block;
        position: absolute;
        width: 120px;
        text-align: right;
        padding-right: 12px;
    }

    .adresstype {
        border: 1px solid #DCDEE2;
        margin-bottom: 18px;
    }


    .adresstype h3 {
        border-bottom: 1px solid #DCDEE2;
        height: 40px;
        padding: 0 20px;
        font-size: 13px;
        line-height: 40px;
    }

    .adresstype h3 > span {
        color: #EB9620;
        font-size: 12px;
        cursor: pointer;
        line-height: 20px;
        margin-top: 10px;
        float: right;
    }

    .adresstype h3 > span:hover {
        background: rgba(235, 150, 32, 0.25);
    }

    .adresstype h3 > span.del {
        color: #515a6e;
        margin-left: 20px;
    }

    .adresstype h3 > span.del:hover {
        color: #FF0010;
        background: transparent;
    }

    .emerContact h3 span {
        color: rgb(81, 90, 110);
        font-size: 12px;
    }

    .emerContact h3 span.del:hover {
        color: #FF0010;
        cursor: pointer;
    }
</style>
